{# SPDX-FileCopyrightText: © 2014-2015, 2018 Siemens AG

   SPDX-License-Identifier: FSFAP
#}

  <!-- The text Modal -->
  <div class="modal" id="textModal" tabindex="-1" role="dialog" aria-labelledby="textModalLabel" aria-hidden="true" data-backdrop="false">
    <div class="modal-dialog modal-dialog-centered">
      <div class="modal-content">
        <!-- Modal Header -->
        <div class="modal-header">
          <h4 class="modal-title">Enter Content</h4>
        </div>
        <!-- Modal body -->
        <div class="modal-body">
          <form name="addOrRemoveText">
          <div id="textModalComment" style="padding:2px;"></div>
            <div>{{ 'Please enter the text phrase:'|trans }}</div>
            <textarea id="referenceText" class="form-control-sm" style="overflow:auto;width:100%;height:80px;" name="referenceText"></textarea>
          </form>
        </div>
        <!-- Modal footer -->
        <div class="modal-footer">
          <button type="button" class="btn" id="selectFromNoticeFile" style="display:none;width:96%;" onclick="openAckInputModal();">Select from Notice File</button>
          <button type="button" class="btn" id="clearText" style="display:none;width:96%;" onclick="cleanText( $('#referenceText') );">{{ 'Clean Text'|trans }}</button>
          <button type="button" class="btn btn-danger" onclick="closeTextModal();" data-dismiss="modal">{{ 'Cancel'|trans }}</button>
          <button type="button" class="btn btn-success" onclick="submitTextModal();" data-dismiss="modal">{{ 'Ok'|trans }}</button>
        </div>
      </div>
    </div>
  </div>

  <!-- The text Modal -->
  <div class="modal" id="textAckInputModal" tabindex="-1" role="dialog" aria-labelledby="textModalLabel" aria-hidden="true" data-backdrop="false">
    <div class="modal-dialog modal-dialog-centered">
      <div class="modal-content">
        <!-- Modal Header -->
        <div class="modal-header">
          <h4 class="modal-title">Select Notice</h4>
        </div>
        <!-- Modal body -->
        <div class="modal-body">
          <div id="noticeSelectTableDiv">
            <table id="noticeSelectTable">
              <thead><tr><th>File name</th><th>Content</th><th></th></tr></thead>
            </table>
          </div>
        </div>
        <!-- Modal footer -->
        <div class="modal-footer">
          <button type="button" class="btn btn-danger" onclick="closeAckInputModal();" data-dismiss="modal">{{ 'Cancel'|trans }}</button>
        </div>
      </div>
    </div>
  </div>

  <!-- The bulk Modal -->
  <div class="modal" id="bulkModal" tabindex="-1" role="dialog" aria-labelledby="bulkModelLabel" aria-hidden="true" data-backdrop="false" data-keyboard="false">
    <div class="modal-dialog modal-dialog-centered modal-lg">
      <div class="modal-content">
        <!-- Modal Header -->
        <div class="modal-header">
          <h4 class="modal-title">Bulk Recognition</h4>
          <button type="button" class="close" onclick="closeBulkModal();" data-dismiss="modal" aria-label="Close">
            <span aria-hidden="true">&times;</span>
          </button>
        </div>
        <!-- Modal body -->
        <div class="modal-body">
          {{ 'Notice'|trans }}: {{ 'Since punctuation is included in the matching process, periods needs to be included in the phrases if the word just before is included.'|trans }}
          <br/>
          {{ 'Hint'|trans }}: {{ 'New license candidates can be added via'|trans }}
          <a href="?mod=advice_license">{{ 'menu Organize&raquo;Licenses'|trans }}</a><br/>
          <form name="bulkForm">
            <table>
              <tr>
                <td id="bulkExistingLicense">
                  <select id="bulkLicense" class="ui-render-select2 w-100">
                    {% for license in licenseArray %}
                    <option value="{{ license.id }}" title="{{ license.fullname|e }}">{{ license.shortname|e }}</option>
                    {% endfor %}
                  </select>
                </td>
                <td>
                  <img src="images/info_16.png" data-toggle="tooltip" style="vertical-align:middle !important;" title="{{ 'The user can select an according license'|trans }}" alt="" class="info-bullet"/>
                </td>
                <td class="px-1">
                  <a href="#" id="bulkFormAddLicense" style="font-size:20px;"><img src="images/icons/add_16.png" title="append job to add selected license" alt="+"/></a>
                </td>
                <td class="px-1">
                  <a href="#" id="bulkFormRmLicense" style="font-size:20px;"><img src="images/icons/remove_16.png" title="append job to remove selected license" alt="-"/></a>
                </td>
                <td>
                  <img src="images/info_16.png" data-toggle="tooltip" style="vertical-align:middle !important;" title="{{ 'Adding or removing a license is possible. Removing a license will pull the scanner found license off from the potential clearing decisions. This can be used to correct a scanner finding'|trans }}" alt="" class="info-bullet"/>
                </td>
                <td>
                  <button type="button" class="btn btn-default btn-sm" onclick="popUpLicenseText('{{ bulkUri }}&rf=', '{{ 'License Text'| trans }}');">{{ 'Show license'| trans }}</button>
                </td>
              </tr>
            </table>

            <table id="bulkFormTable" class="dataTable" border="1">
              <thead>
                <hr id="bulkFormTableHead">
                  <th>Action</th>
                  <th>License</th>
                  <th>License Text</th>
                  <th>Acknowledgement</th>
                  <th>Comment</th>
                  <th></th>
                </hr>
              </thead>
              <tbody>
              </tbody>
            </table>

            <br/>
            {{ 'Reference text'| trans }}:<br/>
            <textarea name="bulkRefText" id="bulkRefText" type="text" rows="12" class="form-control"></textarea>
            <div class="container-fluid pt-2">
              <div class="row justify-content-start">
                <div class="col-sm-auto pr-0">
                  <select name="bulkScope" class="form-control-sm" id="bulkScope">
                    <option value="u">{{ 'scan whole Upload'| trans }}</option>
                    <option value="f">{{ 'scan only current Folder'| trans }}</option>
                  </select>
                  <img src="images/info_16.png" data-toggle="tooltip" data-placement="left" title="{{ 'Scan whole upload or this folder determines the scope of files where the text phrase is searched for. If “scan whole upload” is selected, the text phrase is searched in all files of the entire upload'|trans }}" alt="" class="info-bullet"/></img>
                </div>
                <div class="col-sm-auto pr-0">
                  <div class="form-check form-check-inline">
                    <input type="checkbox" class="form-check-input" id="forceDecision"/>
                    <label for="forceDecision" class="form-check-label">
                      {{ 'Ignore conflicts'|trans }}
                      <img src="images/info_16.png" data-toggle="tooltip" data-placement="left" title="{{ 'The bulk scan will create a clearing result, if the resulting list of licenses does not show conflicts. A conflict would be two different license ids for example. Imagine Nomos has found “Apache-1.0” and a bulk scan finds a text phrase with Apache-2.0 set, this represents a conflict. Otherwise if Nomos found Apache-2.0 and the bulk scan find a text phrase with “Apache-2.0” set, this is free from conflicts and a clearing result is set. Normally conflicts prevent clearing results. Checking the “ignore conflicts” will set a clearing decision in any case'|trans }}" alt="" class="info-bullet"/></img>
                    </label>
                  </div>
                </div>
                <div class="col-sm-auto pr-0">
                  <div class="form-check form-check-inline">
                    <input type="checkbox" class="form-check-input" id="bulkIgnoreIrre" checked="checked"/>
                    <label for="bulkIgnoreIrre" class="form-check-label">
                      {{ 'Ignore Irrelevant files'|trans }}
                      <img src="images/info_16.png" data-toggle="tooltip"
                      data-placement="left" style="vertical-align:middle !important;"
                      title="{{ 'Do not include files marked as irrevelant for this scan.'|trans }}" alt="" class="info-bullet"/>
                    </label>
                  </div>
                </div>
                <div class="col-sm-auto pr-0">
                  <div class="form-check form-check-inline">
                    <input type="checkbox" class="form-check-input" id="custDelim"/>
                    <label for="custDelim" class="form-check-label">
                      {{ 'Custom delimiters'|trans }}
                      <img src="images/info_16.png" data-toggle="tooltip"
                      data-placement="left" style="vertical-align:middle !important;"
                      title="{{ 'Provide custom list of characters for spliting tokens for scan. Note, the characters will be ignored.'|trans }}"
                      alt="" class="info-bullet"/>
                    </label>
                  </div>
                </div>
              </div>
              <div class="row pt-2 invisible" id="delimRow">
                <div class="col-md-auto">
                  <label for="delimdrop" class="col-form-label">
                    Delimiters:
                  </label>&nbsp;<img src="images/info_16.png"
                    data-toggle="tooltip"
                    data-placement="left"
                    title="{{ 'Use default list of delimiters (\' \\t\\n\\r\\f#^%,*\') or type your own in the box. Currently limited to single characters only and space is always a delimiter.'|trans }}"
                    alt="" class="info-bullet"/>
                </div>
                <div class="col">
                  <div class="input-group input-group-sm">
                    <div class="input-group-prepend">
                      <button class="btn btn-outline-secondary" type="button" id="resetDel">Reset</button>
                    </div>
                    <input class="form-control" id="delimdrop" type="text" value="DEFAULT">
                  </div>
                </div>
              </div>
            </div>
            <input name="uploadTreeId" id="uploadTreeId" type="hidden" value="{{ itemId }}" />
          </form>
        </div>
        <!-- Modal footer -->
        <div class="modal-footer">
          <button type="button" class="btn btn-danger" onclick="closeBulkModal();" data-dismiss="modal">Cancel</button>
          <button type="button" class="btn btn-success" onclick="cleanText( $('#bulkRefText') );">{{ 'Clean text'|trans }}</button>
          <img src="images/info_16.png" data-toggle="tooltip" style="vertical-align:middle;" title="{{ 'The matching process ignores comment symbols, e.g. double-slashes. Hence, these symbols can be remove from bulk text.'|trans }}" alt="" class="info-bullet"/></img>
          <button type="button" class="btn btn-success" onclick="scheduleBulkScan();" data-dismiss="modal">{{ 'Schedule Bulk scan'|trans }}</button>
        </div>
      </div>
    </div>
  </div>
